﻿using System;

namespace Hanoi
{
    class Program
    {
        /// <summary>
        /// 用递归做汉诺塔问题
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            
            Console.WriteLine("输入汉诺塔层数：");
            int n = Int32.Parse(Console.ReadLine());
            Hanoi(n, "TowerA", "TowerB", "TowerC");
            Console.WriteLine();
        }

        private static void Hanoi(int n, string origin, string temp, string destination)
        {
            if (n == 1)
            {
                move(origin, destination);
            }
            else
            {
                Hanoi(n - 1, origin, destination, temp);
                move(origin, destination);
                Hanoi(n - 1, temp, origin, destination);
            }
           
        }

        private static void move(string origin, string destination)
        {
            Console.WriteLine("Move the plate from " + origin + " to " + destination+",");
        }
    }
}
